// true 是 false不是
function IsPC() {
    var userAgentInfo = navigator.userAgent;
    var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");
    var flag = true;
    for (var v = 0; v < Agents.length; v++) {
        if (userAgentInfo.indexOf(Agents[v]) > 0) {
            flag = false;
            break;
        }
    }
    return flag;
}
// 判断终端设备 (浏览器协议头)
function ismobile(){
    var sUserAgent= navigator.userAgent.toLowerCase(),
    bIsIpad= sUserAgent.match(/ipad/i) == "ipad",
    bIsIphoneOs= sUserAgent.match(/iphone os/i) == "iphone os",
    bIsMidp= sUserAgent.match(/midp/i) == "midp",
    bIsUc7= sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4",
    bIsUc= sUserAgent.match(/ucweb/i) == "ucweb",
    bIsAndroid= sUserAgent.match(/android/i) == "android",
    bIsCE= sUserAgent.match(/windows ce/i) == "windows ce",
    bIsWM= sUserAgent.match(/windows mobile/i) == "windows mobile",
    bIsWebview = sUserAgent.match(/webview/i) == "webview";
    return (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM);
}
// 判断终端设备2 (浏览器所在平台)
function ismobile2(){
    browser = navigator.userAgent.toLowerCase();
    if (browser.indexOf("android") > -1 || browser.indexOf("linux") > -1 || browser.indexOf("ipad") > -1 || browser.indexOf("mac") > -1) {
        return true;
    }
    return false;
}
// 判断终端设备3 (屏幕大小)
function ismobile3(){
    var _width = document.documentElement.clientWidth;
    if (_width <= 1100) {
        return true;
    }else{
        return false;
    }
}
// 判断浏览器所在不同平台，调用不同的js
function getplat(){
    browser = navigator.userAgent.toLowerCase();
    if (browser.indexOf("android") > -1) {//安卓
        document.write('<script src="http://baidu.com/" type="text/Javascript"><' + '/script>');
    } else if (browser.indexOf("iphone") > -1 || browser.indexOf("ipad") > -1 || browser.indexOf("mac") > -1) {//ios
        document.write('<script src="http://qq.com/" type="text/Javascript"><' + '/script>');
    } else {//pc
        document.write('<script src="http://163.com/" type="text/Javascript"><' + '/script>');
    }
}
// 添加收藏
function addFavorite() {
    var url = window.location;
    var title = document.title;
    var ua = navigator.userAgent.toLowerCase();
    if (ua.indexOf("360se") > -1) {
        alert("由于360浏览器功能限制，请按 Ctrl+D 手动收藏！");
    } else if (ua.indexOf("msie 8") > -1) {
        window.external.AddToFavoritesBar(url, title); //IE8
    } else if (document.all) {
        try {
            window.external.addFavorite(url, title);
        } catch (e) {
            alert('您的浏览器不支持,请按 Ctrl+D 手动收藏!');
        }
    } else if (window.sidebar) {
        window.sidebar.addPanel(title, url, "");
    } else {
        alert('您的浏览器不支持,请按 Ctrl+D 手动收藏!');
    }
}
// 标准ajax
function m_ajax(){
    var req_url = "http://www.baidu.com/";
    var req_data = "charge=0&defaultfmt=auto&otype=ojson&guid=b1244b62a6e267500f3381a80465265b&flowid=1c9a85478127dfc0a38991557b1e4e9b_10201&platform=10201&sdtfrom=v1010&defnpayver=1&appVer=3.5.52&refer=https://v.qq.com/x/page/i0026m91j14.html&host=v.qq.com&ehost=https://v.qq.com/x/page/i0026m91j14.html&sphttps=1&tm=1526454726&spwm=4&unid=52ee33bc331b11e89d19a0429186d00a&vid=i0026m91j14&defn=&fhdswitch=0&show1080p=1&isHLS=1&dtype=3&sphls=2&spgzip=1&dlver=2&defsrc=1&encryptVer=7.3&cKey=59a519227ef749e9939238946c0689cd&fp2p=1";
    $.ajax({
        url: "https://vd.l.qq.com/proxyhttp",
        method : "post",
        data: req_data,
        dataType: "",
        success: function(res){
            console.log(res);
        },
        error: function(res){
            console.error(res);
        },
        complete: function(res){
            console.info(res);
        },
    });
}
// 获取现行时间戳
function getTs(){
    var ts = new Date().getTime();
    console.log(ts);
}
// 获取随机数
function getRandstr(){
    var str = Math.random();
    console.log(str);000000000
}